<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="收发存明细表" />
<%@ include file="../inc/PrintTitle.jsp"%>
<head>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doCancel(){
		window.close();
	}
	function doPrint(){
		ShowConfirm('确认框','确定开始打印吗？',340,80,"doPrintCallBack()");
	}
	function doPrintCallBack(){
		if(popRetVal!=null){
			var len=${fn:length(list)};
			var isIE = (navigator.userAgent.indexOf('MSIE')>=0) || (navigator.userAgent.indexOf('Trident')>=0);
			document.getElementById("noPrinSpan").style.display="none";
			if(len>200 && isIE){
				iePrint("wb","${enterpriseInfo.doPrint}");
			}else{
				printContent("管理易-收发存明细表","${enterpriseInfo.doPrint}","${enterpriseInfo.printWidth}");
			}
			document.getElementById("noPrinSpan").style.display="";
		}
	}
</script>
</head>
<body style="background-color:#FFFFFF">
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td height="40px" align="center" class="FontLarge_Bold">${licenseInfo.enterpriseName} 收发存明细表</td>
				</tr>
		  </table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="ListTable">
				<tr class="ListTrPrint">
			      	<td class="FontSmall" width="20%">仓库：${stoName}</td>
			      	<td class="FontSmall" width="40%">材料类别：${ptName}
						<c:if test="${proCode!=null && proCode!=''}">材料编号：<c:out value="${proCode}" /></c:if>
						<c:if test="${proName!=null && proName!=''}">品名规格：<c:out value="${proName}" /></c:if>
					</td>
			      	<td width="40%" class="FontSmall" align="right"><c:if test="${searchTime!=null && searchTime!=''}">查询日期：${searchTime}</c:if></td>
				</tr>
		  </table>
		</td>
	</tr>
	<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';STOR_COST;')!=-1}">
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" class="ListTable">
				<tr class="ListTrPrint">
			      	<td class="FontSmall">入库金额小计：${inCost}元&nbsp;&nbsp;出库金额小计：${outCost}元</td>
				</tr>
		  </table>
		</td>
	</tr>
	</c:if>
	<tr>
		<td height="3"></td>
	</tr>
	<tr>
		<td>
			<table width="98%" align="center" cellpadding="0" cellspacing="0" class="small_border">
				<tr class="ListTrPrint">
				  	<td class="ListTd FontSmall_Bold" width="13%" rowSpan="2" height="23" align="center">单号</td>
					<td class="ListTd FontSmall_Bold" width="9%" rowSpan="2" align="center">日期</td>
					<td class="ListTd FontSmall_Bold" width="9%" rowSpan="2" align="center">供方/需方</td>
					<td class="ListTd FontSmall_Bold" width="4%" rowSpan="2" align="center">类型</td>
					<td class="ListTd FontSmall_Bold" width="9%" rowSpan="2" align="center">备注</td>
					<td class="ListTd FontSmall_Bold" width="8%" rowSpan="2" align="center">材料编号</td>
					<td class="ListTd FontSmall_Bold" width="8%" rowSpan="2" align="center">品名规格</td>
					<td class="ListTd FontSmall_Bold" width="4%" rowSpan="2" align="center">单位</td>
					<td class="ListTd FontSmall_Bold" width="12%" colSpan="3" align="center">入库</td>
					<td class="ListTd FontSmall_Bold" width="12%" colSpan="3" align="center">出库</td>
					<td class="ListTd FontSmall_Bold" width="12%" colSpan="3" align="center">结存</td>
				</tr>
				<tr>
					<td class="ListTd FontSmall_Bold" width="4%" align="center">数量</td>
					<td class="ListTd FontSmall_Bold" width="4%" align="center">单价</td>
					<td class="ListTd FontSmall_Bold" width="4%" align="center">金额</td>
					<td class="ListTd FontSmall_Bold" width="4%" align="center">数量</td>
					<td class="ListTd FontSmall_Bold" width="4%" align="center">单价</td>
					<td class="ListTd FontSmall_Bold" width="4%" align="center">金额</td>
					<td class="ListTd FontSmall_Bold" width="4%" align="center">数量</td>
					<td class="ListTd FontSmall_Bold" width="4%" align="center">单价</td>
					<td class="ListTd FontSmall_Bold" width="4%" align="center">金额</td>
				</tr>
				<c:forEach var="item" items="${list}" varStatus="i">
				<c:set var="styleStr" value="" />
 				<c:if test="${item.operType=='UN_EXAM' || item.operType=='CANC' || item.operType=='UN_STOC'}"><c:set var="styleStr" value="style='color:red'" /></c:if>
				<tr class="ListTrPrint" ${styleStr}>
					<td class="FontSmall"  align="center">${item.billCode}</td>
					<td class="FontSmall"  align="center"><fmt:formatDate value="${item.billDate}" pattern="yyyy-MM-dd"/></td>
					<td class="FontSmall"  align="center">${item.otherName}</td>
					<td class="FontSmall"  align="center">
						<c:if test="${item.billType=='IN_BILL'}">入</c:if>
						<c:if test="${item.billType=='PURC_BILL'}">采购</c:if>
						<c:if test="${item.billType=='OUT_BILL'}">出</c:if>
						<c:if test="${item.billType=='ALLO_BILL' && item.ioType=='OUT'}">调出</c:if>
						<c:if test="${item.billType=='ALLO_BILL' && item.ioType=='IN'}">调入</c:if>
					</td>
					<td class="FontSmall" align="center">${item.mark}</td>
					<td class="FontSmall" align="center">${item.productCode}</td>
					<td class="FontSmall" align="center">${item.productName}</td>
					<td class="FontSmall"  align="center">${item.productUnit}</td>
					<td class="FontSmall"  align="right"><commonTag:parseBigDecimal source="${item.inAmount}" /></td>
					<td class="FontSmall"  align="right"><c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';STOR_COST;')!=-1}"><commonTag:parseBigDecimal source="${item.inUnitPrice}" /></c:if></td>
					<td class="FontSmall"  align="right"><c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';STOR_COST;')!=-1}"><commonTag:parseBigDecimal source="${item.inCost}" /></c:if></td>
					<td class="FontSmall"  align="right"><commonTag:parseBigDecimal source="${item.outAmount}" /></td>
					<td class="FontSmall"  align="right"><c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';STOR_COST;')!=-1}"><commonTag:parseBigDecimal source="${item.outUnitPrice}" /></c:if></td>
					<td class="FontSmall"  align="right"><c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';STOR_COST;')!=-1}"><commonTag:parseBigDecimal source="${item.outCost}" /></c:if></td>
					<td class="FontSmall"  align="right"><commonTag:parseBigDecimal source="${item.balAmount}" /></td>
					<td class="FontSmall"  align="right"><c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';STOR_COST;')!=-1}"><commonTag:parseBigDecimal source="${item.balUnitPrice}" /></c:if></td>
					<td class="FontSmall"  align="right"><c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';STOR_COST;')!=-1}"><commonTag:parseBigDecimal source="${item.balCost}" /></c:if></td>
				</tr>
				</c:forEach>
		  </table>
		</td>
	</tr>
	<tr id="noPrinSpan">
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td>
						<input type="button" id="printButton" class="Button" value="开始打印" onClick="doPrint();">
						<input type="button" id="cancelButton" class="Button" value=" 退 出 " onClick="doCancel();">
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</body>
</html>